angular.module('starter')
  .config(function($stateProvider) {
    $stateProvider.state('addTable6', {
      url: '/addTable6/:tableId',
      templateUrl: 'templates/addTable6/addTable6.html',
      controller: 'addTable6Ctrl',
      controllerAs: 'addTable6Ctrl'
    })
  })
  .controller('addTable6Ctrl', function($scope) {

    this.data = {
      teamName: "无锡路桥",
      checkEmployerName: "监理公司",
      pageNum: "123",
      tableType: 4, // 表格类型
      layerType: "1", // 面层类型1 2 3 
      recordNo: "1234", // 编号
      workTime: "2016-05-05", // 施工日期str
      workTimeDate: null, // 施工日期Date
      writeDate: "", // 填表日期
      defectIshandled: 1, // 下承层缺陷是否处理完毕 
      status: 1, // 状态:0:草稿;1:新增
      postil: "批注批注批注批注批注", // 批注
      workPoint: "1", // 作业点
      startStake: "", //起始桩号
      startStakeFirst: "12",
      startStakeLast: "33",
      endStake: "", //截止桩号
      endStakeFirst: "34",
      endStakeLast: "54",
      illustrate: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      checkItemMap: {
        workCheckIHasTemporaryPollution: [{
          recordTime: "2016-09-28",
          recordTimeDate: null,
          recordResult: 1
        }],
        workCheckIRecordOfPaverDowntime: [{
          recordTime: "2016-09-28",
          recordTimeDate: null,
          recordResult: 1
        }],
        workCheckITimesOfPaverGatheringMixtutre: [{ // 检查项键           
          recordTime: "",
          recordTimeDate: null,
          recordResult: 1
        }],
        workCheckISpeedOfPaving: [{ // 检查项键           
          recordTime: "2016-09-28",
          recordTimeDate: null,
          recordResult: 1
        }],
        workCheckIPaverScreedTamperVibrationLevel: [{ // 检查项键           
          recordTime: "",
          recordTimeDate: null,
          recordResult: 1
        }],
        workCheckIWorkingsOfSpiralCaseAndBedLevel: [{ // 检查项键           
          recordTime: "",
          recordTimeDate: null,
          recordResult: 1
        }]
      }
    };

    this.checkItem = function() {
      this.workTime = $scope.dateToStr(this.data.workTimeDate, 'yyyy-MM-dd');

      return true;
    }

    this.saveTable = function() {
      console.log(this.data);
      if (this.checkItem()) {
        $scope.showAlert("新增成功");
      }
    };

  });